/*
 * DayOfWeek.java   1.0 Nov 6, 2013
 */


public enum DayOfWeek {
    SUNDAY("Sunday", 0),
    MONDAY("Monday", 1),
    TUESDAY("Tuesday", 2),
    WEDNESDAY("Wednesday", 3),
    THURSDAY("Thursday", 4),
    FRIDAY("Friday", 5),
    SATURDAY("Saturday", 6);

    private String dayName;
    private int dayNumber;

    DayOfWeek(String dayName, int dayNumber) {
        this.dayName = dayName;
        this.dayNumber = dayNumber;
    }

    public String getDayName() {
        return dayName;
    }

    public static String getDayNameByNumber(int dayNumber) {
        for (DayOfWeek dow : values()) {
            if (dow.getDayNumber() == dayNumber) {
                return dow.getDayName();
            }
        }

        return "";
    }

    public int getDayNumber(){
        return dayNumber;
    }
}

